﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
namespace Lawyer.Web.ArchiveBaseInfo
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtArchiveID.Text.Trim().Length==0)
			{
				strErr+="ArchiveID不能为空！\\n";	
			}
			if(this.txtFullName.Text.Trim().Length==0)
			{
				strErr+="FullName不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtBirthday.Text))
			{
				strErr+="Birthday格式错误！\\n";	
			}
			if(this.txtTelphone.Text.Trim().Length==0)
			{
				strErr+="Telphone不能为空！\\n";	
			}
			if(this.txtFax.Text.Trim().Length==0)
			{
				strErr+="Fax不能为空！\\n";	
			}
			if(this.txtAddress.Text.Trim().Length==0)
			{
				strErr+="Address不能为空！\\n";	
			}
			if(this.txtCFullName.Text.Trim().Length==0)
			{
				strErr+="CFullName不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtCBirthday.Text))
			{
				strErr+="CBirthday格式错误！\\n";	
			}
			if(this.txtCTelphone.Text.Trim().Length==0)
			{
				strErr+="CTelphone不能为空！\\n";	
			}
			if(this.txtCFax.Text.Trim().Length==0)
			{
				strErr+="CFax不能为空！\\n";	
			}
			if(this.txtCEmail.Text.Trim().Length==0)
			{
				strErr+="CEmail不能为空！\\n";	
			}
			if(this.txtCRelation.Text.Trim().Length==0)
			{
				strErr+="CRelation不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtBankFunds.Text))
			{
				strErr+="BankFunds格式错误！\\n";	
			}
			if(this.txtBankAccount.Text.Trim().Length==0)
			{
				strErr+="BankAccount不能为空！\\n";	
			}
			if(this.txtCaseSource.Text.Trim().Length==0)
			{
				strErr+="CaseSource不能为空！\\n";	
			}
			if(this.txtPersonalDetail.Text.Trim().Length==0)
			{
				strErr+="PersonalDetail不能为空！\\n";	
			}
			if(this.txtPersonalNote.Text.Trim().Length==0)
			{
				strErr+="PersonalNote不能为空！\\n";	
			}
			if(this.txtFatherName.Text.Trim().Length==0)
			{
				strErr+="FatherName不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtFatherDOB.Text))
			{
				strErr+="FatherDOB格式错误！\\n";	
			}
			if(this.txtFatherNationality.Text.Trim().Length==0)
			{
				strErr+="FatherNationality不能为空！\\n";	
			}
			if(this.txtFatherContact.Text.Trim().Length==0)
			{
				strErr+="FatherContact不能为空！\\n";	
			}
			if(this.txtMotherName.Text.Trim().Length==0)
			{
				strErr+="MotherName不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtMotherDOB.Text))
			{
				strErr+="MotherDOB格式错误！\\n";	
			}
			if(this.txtMotherNationality.Text.Trim().Length==0)
			{
				strErr+="MotherNationality不能为空！\\n";	
			}
			if(this.txtMotherContact.Text.Trim().Length==0)
			{
				strErr+="MotherContact不能为空！\\n";	
			}
			if(this.txtSisterName.Text.Trim().Length==0)
			{
				strErr+="SisterName不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtSisterDOB.Text))
			{
				strErr+="SisterDOB格式错误！\\n";	
			}
			if(this.txtSisterContact.Text.Trim().Length==0)
			{
				strErr+="SisterContact不能为空！\\n";	
			}
			if(this.txtSisterNationality.Text.Trim().Length==0)
			{
				strErr+="SisterNationality不能为空！\\n";	
			}
			if(this.txtBrotherName.Text.Trim().Length==0)
			{
				strErr+="BrotherName不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtBrotherDOB.Text))
			{
				strErr+="BrotherDOB格式错误！\\n";	
			}
			if(this.txtBrotherNationality.Text.Trim().Length==0)
			{
				strErr+="BrotherNationality不能为空！\\n";	
			}
			if(this.txtBrotherContact.Text.Trim().Length==0)
			{
				strErr+="BrotherContact不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtAgreedFees.Text))
			{
				strErr+="AgreedFees格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtFeesClusive.Text))
			{
				strErr+="FeesClusive格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtFeesFundable.Text))
			{
				strErr+="FeesFundable格式错误！\\n";	
			}
			if(this.txtPersonalStatement.Text.Trim().Length==0)
			{
				strErr+="PersonalStatement不能为空！\\n";	
			}
			if(this.txtLawyerNote.Text.Trim().Length==0)
			{
				strErr+="LawyerNote不能为空！\\n";	
			}
			if(this.txtAssetAName.Text.Trim().Length==0)
			{
				strErr+="AssetAName不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtAssetAWorth.Text))
			{
				strErr+="AssetAWorth格式错误！\\n";	
			}
			if(this.txtAssetANote.Text.Trim().Length==0)
			{
				strErr+="AssetANote不能为空！\\n";	
			}
			if(this.txtAssetADetail.Text.Trim().Length==0)
			{
				strErr+="AssetADetail不能为空！\\n";	
			}
			if(this.txtAssetBName.Text.Trim().Length==0)
			{
				strErr+="AssetBName不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtAssetBWorth.Text))
			{
				strErr+="AssetBWorth格式错误！\\n";	
			}
			if(this.txtAssetBNote.Text.Trim().Length==0)
			{
				strErr+="AssetBNote不能为空！\\n";	
			}
			if(this.txtAssetBDetail.Text.Trim().Length==0)
			{
				strErr+="AssetBDetail不能为空！\\n";	
			}
			if(this.txtAssetCName.Text.Trim().Length==0)
			{
				strErr+="AssetCName不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtAssetCWorth.Text))
			{
				strErr+="AssetCWorth格式错误！\\n";	
			}
			if(this.txtAssetCNote.Text.Trim().Length==0)
			{
				strErr+="AssetCNote不能为空！\\n";	
			}
			if(this.txtAssetCDetail.Text.Trim().Length==0)
			{
				strErr+="AssetCDetail不能为空！\\n";	
			}
			if(this.txtUpdatedBy.Text.Trim().Length==0)
			{
				strErr+="UpdatedBy不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtUpdatedDate.Text))
			{
				strErr+="UpdatedDate格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			string ArchiveID=this.txtArchiveID.Text;
			string FullName=this.txtFullName.Text;
			DateTime Birthday=DateTime.Parse(this.txtBirthday.Text);
			string Telphone=this.txtTelphone.Text;
			string Fax=this.txtFax.Text;
			string Address=this.txtAddress.Text;
			string CFullName=this.txtCFullName.Text;
			DateTime CBirthday=DateTime.Parse(this.txtCBirthday.Text);
			string CTelphone=this.txtCTelphone.Text;
			string CFax=this.txtCFax.Text;
			string CEmail=this.txtCEmail.Text;
			string CRelation=this.txtCRelation.Text;
			decimal BankFunds=decimal.Parse(this.txtBankFunds.Text);
			string BankAccount=this.txtBankAccount.Text;
			string CaseSource=this.txtCaseSource.Text;
			string PersonalDetail=this.txtPersonalDetail.Text;
			string PersonalNote=this.txtPersonalNote.Text;
			string FatherName=this.txtFatherName.Text;
			DateTime FatherDOB=DateTime.Parse(this.txtFatherDOB.Text);
			string FatherNationality=this.txtFatherNationality.Text;
			string FatherContact=this.txtFatherContact.Text;
			string MotherName=this.txtMotherName.Text;
			DateTime MotherDOB=DateTime.Parse(this.txtMotherDOB.Text);
			string MotherNationality=this.txtMotherNationality.Text;
			string MotherContact=this.txtMotherContact.Text;
			string SisterName=this.txtSisterName.Text;
			DateTime SisterDOB=DateTime.Parse(this.txtSisterDOB.Text);
			string SisterContact=this.txtSisterContact.Text;
			string SisterNationality=this.txtSisterNationality.Text;
			string BrotherName=this.txtBrotherName.Text;
			DateTime BrotherDOB=DateTime.Parse(this.txtBrotherDOB.Text);
			string BrotherNationality=this.txtBrotherNationality.Text;
			string BrotherContact=this.txtBrotherContact.Text;
			decimal AgreedFees=decimal.Parse(this.txtAgreedFees.Text);
			int FeesClusive=int.Parse(this.txtFeesClusive.Text);
			int FeesFundable=int.Parse(this.txtFeesFundable.Text);
			string PersonalStatement=this.txtPersonalStatement.Text;
			string LawyerNote=this.txtLawyerNote.Text;
			string AssetAName=this.txtAssetAName.Text;
			decimal AssetAWorth=decimal.Parse(this.txtAssetAWorth.Text);
			string AssetANote=this.txtAssetANote.Text;
			string AssetADetail=this.txtAssetADetail.Text;
			string AssetBName=this.txtAssetBName.Text;
			decimal AssetBWorth=decimal.Parse(this.txtAssetBWorth.Text);
			string AssetBNote=this.txtAssetBNote.Text;
			string AssetBDetail=this.txtAssetBDetail.Text;
			string AssetCName=this.txtAssetCName.Text;
			decimal AssetCWorth=decimal.Parse(this.txtAssetCWorth.Text);
			string AssetCNote=this.txtAssetCNote.Text;
			string AssetCDetail=this.txtAssetCDetail.Text;
			string UpdatedBy=this.txtUpdatedBy.Text;
			DateTime UpdatedDate=DateTime.Parse(this.txtUpdatedDate.Text);

			Lawyer.Model.ArchiveBaseInfo model=new Lawyer.Model.ArchiveBaseInfo();
			model.ArchiveID=ArchiveID;
			model.FullName=FullName;
			model.Birthday=Birthday;
			model.Telphone=Telphone;
			model.Fax=Fax;
			model.Address=Address;
			model.CFullName=CFullName;
			model.CBirthday=CBirthday;
			model.CTelphone=CTelphone;
			model.CFax=CFax;
			model.CEmail=CEmail;
			model.CRelation=CRelation;
			model.BankFunds=BankFunds;
			model.BankAccount=BankAccount;
			model.CaseSource=CaseSource;
			model.PersonalDetail=PersonalDetail;
			model.PersonalNote=PersonalNote;
			model.FatherName=FatherName;
			model.FatherDOB=FatherDOB;
			model.FatherNationality=FatherNationality;
			model.FatherContact=FatherContact;
			model.MotherName=MotherName;
			model.MotherDOB=MotherDOB;
			model.MotherNationality=MotherNationality;
			model.MotherContact=MotherContact;
			model.SisterName=SisterName;
			model.SisterDOB=SisterDOB;
			model.SisterContact=SisterContact;
			model.SisterNationality=SisterNationality;
			model.BrotherName=BrotherName;
			model.BrotherDOB=BrotherDOB;
			model.BrotherNationality=BrotherNationality;
			model.BrotherContact=BrotherContact;
			model.AgreedFees=AgreedFees;
			model.FeesClusive=FeesClusive;
			model.FeesFundable=FeesFundable;
			model.PersonalStatement=PersonalStatement;
			model.LawyerNote=LawyerNote;
			model.AssetAName=AssetAName;
			model.AssetAWorth=AssetAWorth;
			model.AssetANote=AssetANote;
			model.AssetADetail=AssetADetail;
			model.AssetBName=AssetBName;
			model.AssetBWorth=AssetBWorth;
			model.AssetBNote=AssetBNote;
			model.AssetBDetail=AssetBDetail;
			model.AssetCName=AssetCName;
			model.AssetCWorth=AssetCWorth;
			model.AssetCNote=AssetCNote;
			model.AssetCDetail=AssetCDetail;
			model.UpdatedBy=UpdatedBy;
			model.UpdatedDate=UpdatedDate;

			Lawyer.BLL.ArchiveBaseInfo bll=new Lawyer.BLL.ArchiveBaseInfo();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
